package cn.cs.service;

import cn.cs.mapper.WithdrawalApplyMapper;
import cn.cs.mapper.WxAccessTokenMapper;
import cn.cs.pojo.WxAccessToken;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * yuexl
 */
@RestController
public class WxAccessService {
    private static final Logger logger = LoggerFactory.getLogger(WxAccessService.class);

    @Resource
    private WxAccessTokenMapper wxAccessTokenMapper;


    @RequestMapping(value = "/getWxAccessTokenById", method = RequestMethod.POST)
    public WxAccessToken getWxAccessTokenById(@RequestParam("id") String id){
        return wxAccessTokenMapper.getWxAccessTokenById(id);
    }

    @RequestMapping(value = "/getWxAccessTokenListByMap", method = RequestMethod.POST)
    public List<WxAccessToken> getWxAccessTokenListByMap(@RequestBody Map<String, Object> param) throws Exception{
        return wxAccessTokenMapper.getWxAccessTokenListByMap(param);
    }

    @RequestMapping(value = "/getWxAccessTokenCountByMap", method = RequestMethod.POST)
    public Integer getWxAccessTokenCountByMap(@RequestBody Map<String, Object> param) throws Exception{
        return wxAccessTokenMapper.getWxAccessTokenCountByMap(param);
    }

    @RequestMapping(value = "/addWxAccessToken", method = RequestMethod.POST)
    public Integer addWxAccessToken(@RequestBody WxAccessToken wxAccessToken) throws Exception{
        return wxAccessTokenMapper.insertWxAccessToken(wxAccessToken);
    }

    @RequestMapping(value = "/modifyWxAccessToken", method = RequestMethod.POST)
    public Integer modifyWxAccessToken(@RequestBody WxAccessToken wxAccessToken) throws Exception{
        return wxAccessTokenMapper.updateWxAccessToken(wxAccessToken);
    }

    @RequestMapping(value = "/deleteWxAccessTokenById", method = RequestMethod.POST)
    public Integer deleteWxAccessTokenById(@RequestParam("id") Long id) throws Exception{
        return wxAccessTokenMapper.deleteWxAccessTokenById(id);
    }
}
